import request from '@/utils/request'
import type {
  SendCodeDTO,
  UserLoginDTO,
  BindPhoneDTO,
  BindEmailDTO
} from '@/api/DTO/account'
import type { UpdateUserDTO } from '@/api/DTO/user'
//发送测试请求
const baseUrl = '/account'
export const about = () => {
  return request.get(baseUrl + '/about')
}
//0. 发送验证码
export const sendCodeServer = (data: any) => {
  return request.post(baseUrl + '/sendCode', data)
}

//1. 登录
export const userLoginServer = (data: UserLoginDTO) => {
  return request.post(baseUrl + '/login/user', data)
}

//2. 注册
export const userRegisterServer = (data: UserLoginDTO) => {
  return request.post(baseUrl + '/register', data)
}

//3. 忘记密码 重置
export const userForgetServer = (data: UserLoginDTO) => {
  return request.post(baseUrl + '/refund', data)
}

//4.登出
export const logoutServer = () => {
  return request.get(baseUrl + '/logout')
}

//5. 更新用户信息
export const updateUserInfoServer = (updateUserDTO: UpdateUserDTO) => {
  return request.put(baseUrl + '/update', updateUserDTO)
}
//6. 绑定/解绑手机号
export const bindPhoneServer = (bindPhoneDTO: BindPhoneDTO) => {
  return request.post(baseUrl + '/binding/phone', bindPhoneDTO)
}
//7. 绑定/解绑邮箱
export const bindEmailServer = (bindEmailDTO: BindEmailDTO) => {
  return request.post(baseUrl + '/binding/email', bindEmailDTO)
}
